<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/include/taglib.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">

    <title>登录</title>

    <link href="${ctxStatic}css/style.css" rel="stylesheet">
    <link href="${ctxStatic}css/style-responsive.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="${ctxStatic}js/html5shiv.js"></script>
    <script src="${ctxStatic}js/respond.min.js"></script>
    <![endif]-->
    <style type="text/css">
        .error{color:red}
        .form-signin input[type="text"], .form-signin input[type="password"]{
            background: #fff;
        }
    </style>
</head>
<body class="login-body">
<div class="container">
    <form class="form-signin" id="form" onsubmit="return false;">
        <div class="form-signin-heading text-center">
            <h1 class="sign-title">登录</h1>
            <img src="${ctxStatic}images/timg.png" style="width: 30%;height: 40%" alt=""/>
        </div>
        <div class="login-wrap">
            <input type="text" name="username" id="username" required class="form-control" placeholder="请输入用户名" autofocus>
            <input type="password" name="password" id="password" required class="form-control" placeholder="请输入密码" >
            <button style=" margin:0" class="btn btn-lg btn-login btn-block" type="submit" onclick="">
                <i class="fa fa-check"></i>
            </button>

            <label class="checkbox">
                <!--<input type="checkbox" value="remember-me">记住密码-->
                <span class="pull-right">
                    <a data-toggle="modal" href="##myMod al"> 忘记密码?</a>
                </span>
            </label>
        </div>
        <!-- Modal -->
        <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal"
             class="modal fade">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">Forgot Password ?</h4>
                    </div>
                    <div class="modal-body">
                        <p>Enter your e-mail address below to reset your password.</p>
                        <input type="text" name="email" placeholder="Email" autocomplete="off"
                               class="form-control placeholder-no-fix">

                    </div>
                    <div class="modal-footer">
                        <button data-dismiss="modal" class="btn btn-default" type="button">Cancel</button>
                        <button class="btn btn-primary" type="button">Submit</button>
                    </div>
                </div>
            </div>
        </div>
    </form>

</div>


<%@ include file="/WEB-INF/include/js.jsp" %>
<script type="text/javascript">
    $(function(){
        $('#form').validate({
            rules:{
            },
            messages:{
                username:'用户名不能为空',
                password:'密码不能为空'
            },
            submitHandler:function(){
                utils.post({
                    url:'${ctx}/doLogin',
                    data:{
                        username:$('#username').val(),
                        password:$('#password').val()
                    },
                    success:function(data){
                        if(data.code==200){
                            window.location.href='${ctx}/admin/index';
                        }else{
                            layer.alert(data.message);
                        }
                    }
                });
            }
        });
    });
</script>

</body>
</html>
